<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      circle {
        stroke-width: 5px;
        stroke: #f00;
        fill: #ff0;
      }

      circle:hover {
        stroke: #090;
        fill: #fff;
      }
    </style>
  </head>
  <body>
    <svg
      id="mysvg"
      xmlns="http://www.w3.org/2000/svg"
      viewBox="0 0 800 600"
      preserveAspectRatio="xMidYMid meet"
    >
      <circle id="mycircle" cx="400" cy="300" r="50" />
    </svg>

    <script>
      // js操作svg
      const myCircle = document.querySelector('#mycircle')
      myCircle.addEventListener('click', function (e) {
        console.log('circle clicked enlarging...')
        myCircle.setAttribute('r', 60)
      })
    </script>
  </body>
</html>
